Loop Processes Action Icon

Loop Processes Action

Declaration

<AMLOOPPROCESSES RESULTVARIABLE="test [variablename]" KEEPPATHS="yes/no" INCLUDE="test" EXCLUDE="text" SORT="text [options]">
  (block of steps to loop)
</AMLOOP>

See Also

Loop, End Loop, Loop Files, Loop Windows, Loop Expression, Loop Dataset, Loop List, Break

Description

Loops through the filenames of the processes (applications) that are currently running on the system. The variable specified in the Index parameter is updated with the process filename. With each successive loop, the next process filename is retrieved. The loop ends after all the process filenames have been retrieved or when a Break is encountered.

Practical Usage

To perform an action on every process (application) open on the system.

Parameters

General Tab

Result Variable
Text, Required
MARKUP: RESULTVARIABLE="varname"

Specifies an already created variable name that should be populated with the next process name on each successive loop.

No Not Include Path Info
Yes/No, Optional - Default = No
MARKUP: KEEPPATHS="yes"

Specifies that the folder path should be removed from the return value so that a filename only (the process name) is returned.

Advanced Tab

Include Windows
Text, Optional (default {blank} include all)
MARKUP: INCLUDE="*notepad.exe"

Specifies the wildcard mask that should be included in the loop. For example, if *notepad.exe was specified, the loop would only include processes with the name notepad.exe, in other words. all open notepads regardless of the document being displayed or the folder it was launched from. Standard wildcard characters * and ? are allowed.

Exclude Mask
Text, Optional (default {blank} include all)
MARKUP: EXCLUDE="*notepad.exe"

Specifies the wildcard mask that should be excluded from the loop. For example, if *notepad.exe was specified, the loop would exclude all processes with the name notepad.exe. Standard wildcard characters * and ? are allowed.

Output List
Text [options], Optional (default "none")
MARKUP: SORT="ascending"

Specifies whether a sort order should be applied to the values before the loop begins. For example, selecting "ascending" would return the process names in alphabetical order.

The Available Options Are:

none: The results are left in their natural order and not sorted.

ascending: The results sorted in ascending alphabetical order.

descending: The results sorted in descending alphabetical order.

Notes

Standard Error Handling Options
This action also includes the standard "Error Causes" and "On Error" failure handling options/tabs

More on Error Handling Options

Variables and Expressions
All text fields allow the use of expressions by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, a popup expression builder is available in all these fields by pressing F2.
More on variables...

More on expressions...

More on the expression builder...

Examples

<!--- Close all notepad.exe processes --->
<AMVARIABLE NAME="currentprocess"></AMVARIABLE>
<AMLOOPPROCESSES RESULTVARIABLE="currentprocess" INCLUDE="*notepad.exe">
   <AMENDPROCESS PROCESS="%currentprocess%">
</AMLOOP>